London | 26-ITP-JAN | Asha Ahmed | Sprint 2 | Data Groups#1127
Open
ashaahmed7 wants to merge 13 commits intoCodeYourFuture:mainfrom
Open
London | 26-ITP-JAN | Asha Ahmed | Sprint 2 | Data Groups#1127ashaahmed7 wants to merge 13 commits intoCodeYourFuture:mainfrom
ashaahmed7 wants to merge 13 commits intoCodeYourFuture:mainfrom
Conversation
…s, and multiple values per key
…ing '=', and edge cases
cjyuan
reviewed
Apr 1, 2026
| console.log(`${recipe.title} serves ${recipe.serves} | ||
| ingredients: | ||
| ${recipe}`); | ||
| ${recipe.ingredients.join(", ")}`); |
Contributor
There was a problem hiding this comment.
This output does not quite meet the requirement specified on line 5.
Comment on lines
+6
to
+12
| for (let key in object) { | ||
| if (key === name) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; |
Contributor
There was a problem hiding this comment.
Can also considered Object.hasOwn().
| // Then it should return false or throw an error | ||
| it("contains returns false or throws an error if given parameter is not a valid object", () => { | ||
| expect(contains([], "key1")).toEqual(false); | ||
| expect(contains([1, 2], 1)).toEqual(false); |
Contributor
There was a problem hiding this comment.
Can your function pass this test?
expect(contains([1, 2], "1")).toEqual(false);
Comment on lines
+4
to
+10
| if (itemsList.length === 0) { | ||
| return {}; | ||
| } | ||
|
|
||
| if (!Array.isArray(itemsList)) { | ||
| throw new Error("Input must be an array"); | ||
| } |
Contributor
There was a problem hiding this comment.
Does the following function call returns the value you expect?
tally(0);
tally(undefined);
tally("");
tally(["toString", "toString"]);
Note: For the last function call, look up an approach to create an empty object with no inherited properties.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed the exercises in each directory on Sprint 2
Questions
N/A